package GameEngine.Model;

public class WorldObject {

	// Position und Geschwindigkeit
	public float Longitude;
	public float Latitude;
	public float SpeedX;
	public float SpeedY;

	// Aussehen
	public GameObject gameObjekt = null;

	// Mapping
	private CoordinateMapper CM = null;

	public WorldObject(float lng, float lat, float sx, float sy,
			CoordinateMapper cm) {
		Longitude = lng;
		Latitude = lat;
		SpeedX = sx;
		SpeedY = sy;
		CM = cm;
	}

	public void move() {
		if (CM != null) {
			Longitude += SpeedX;
			Latitude += SpeedY;
			int lng = CM.longitudeToMapX(Longitude);
			int lat = CM.latitudeToMapY(Latitude);
			if (gameObjekt != null) {
				gameObjekt.setPosX(lng);
				gameObjekt.setPosY(lat);
			}
		}
	}

	public void draw() {
		if (gameObjekt != null) {
			gameObjekt.getDrawable().draw();
		}
	}

	// Setter

	public GameObject getGameObjekt() {
		return gameObjekt;
	}

	public void setGameObjekt(GameObject gameObjekt) {
		this.gameObjekt = gameObjekt;
	}
}
